package cn.ht.jywrwater.module.ht.dal.mysql.village;

import java.util.*;

import cn.ht.jywrwater.framework.common.pojo.PageResult;
import cn.ht.jywrwater.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ht.jywrwater.framework.mybatis.core.mapper.BaseMapperX;
import cn.ht.jywrwater.module.ht.dal.dataobject.village.VillageDO;
import org.apache.ibatis.annotations.Mapper;
import cn.ht.jywrwater.module.ht.controller.admin.village.vo.*;

/**
 * 村庄 Mapper
 *
 * @author hzx
 */
@Mapper
public interface VillageMapper extends BaseMapperX<VillageDO> {

    default PageResult<VillageDO> selectPage(VillagePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VillageDO>()
                .eqIfPresent(VillageDO::getVillageCode, reqVO.getVillageCode())
                .likeIfPresent(VillageDO::getVillageName, reqVO.getVillageName())
                .eqIfPresent(VillageDO::getPersonCharge, reqVO.getPersonCharge())
                .eqIfPresent(VillageDO::getCustomerTel, reqVO.getCustomerTel())
                .orderByDesc(VillageDO::getId));
    }

    default List<VillageDO> selectList(VillageExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<VillageDO>()
                .eqIfPresent(VillageDO::getVillageCode, reqVO.getVillageCode())
                .likeIfPresent(VillageDO::getVillageName, reqVO.getVillageName())
                .eqIfPresent(VillageDO::getPersonCharge, reqVO.getPersonCharge())
                .eqIfPresent(VillageDO::getCustomerTel, reqVO.getCustomerTel())
                .orderByDesc(VillageDO::getId));
    }

}
